<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>ActiveMqConsumerApplication</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">

    <!-- Javascript -->
    <script th:src="@{/jquery.min.js}"></script>
    <script th:inline="javascript">
        /*<![CDATA[*/
        //当清除缓存时会是这个样子[/;jsessionid=E6DD06F2268E7004E947863FE86FCA06]
        var path = (/*[[@{/}]]*/ +"").split(";")[0];
        /*]]>*/

        var timerId = null;

        $(function () {

        });

        function getData() {
            if (timerId === null) {
                timerId = setInterval(function () {
                    getReceivingQuantity();
                }, 1000);
            }
        }

        function getReceivingQuantity() {
            $.post(path + "getReceivingQuantity", {}, function (result) {
                var text = "ServiceSuccessCount:<span style='color: green'>" + result.ServiceSuccessCount + "</span>" +
                    " ServiceFailCount:<span style='color: red'>" + result.ServiceFailCount + "</span>";
                $("#receiveCount").html(text);
            }, "json");
        }
    </script>
</head>
<body>

<div style="padding: 10px; background-color: darkgrey;">
    <h1>ActviceMq P2P Receive</h1>
    <button onclick="getData()" type="button">查看接收数量</button>
    <br>
    <span id="receiveCount"></span>
</div>

</body>
</html>